import request from '@/utils/http'
import { BaseResult, PageResult } from '@/types/axios'
import {
  WithdrawalType,
  WithdrawalGetAllParam,
  WithdrawalGetByIdParam,
  WithdrawalHandleParam,
  BuyerWithdrawalType,
  BuyerWithdrawalGetAllParam,
  BuyerWithdrawalGetByIdParam,
  FinanceCount,
  FinanceParam,
  BondCount,
  BondParam
} from './model/financeModel'

export class FinanceService {
  // ============================提现申请============================

  // 提现申请管理查询
  static withdrawalGetAll(params: WithdrawalGetAllParam) {
    return request.post<BaseResult<PageResult<WithdrawalType[]>>>({
      url: '/withdrawal/getAll',
      data: params
    })
  }

  // 提现申请查看
  static withdrawalGetById(params: WithdrawalGetByIdParam) {
    return request.post<BaseResult<WithdrawalType>>({
      url: '/withdrawal/getById',
      data: params
    })
  }

  // 提现申请处理
  static withdrawalHandle(params: WithdrawalHandleParam) {
    return request.post<BaseResult>({
      url: '/withdrawal/handle',
      data: params
    })
  }

  // ============================用户提现============================

  // 用户提现申请管理查询
  static buyerWithdrawalGetAll(params: BuyerWithdrawalGetAllParam) {
    return request.post<BaseResult<PageResult<BuyerWithdrawalType[]>>>({
      url: '/buyer_withdrawal/getAll',
      data: params
    })
  }

  // 用户提现申请查看
  static buyerWithdrawalGetById(params: BuyerWithdrawalGetByIdParam) {
    return request.post<BaseResult<BuyerWithdrawalType>>({
      url: '/buyer_withdrawal/getById',
      data: params
    })
  }

  // 用户提现处理
  static buyerWithdrawalHandle(params: BuyerWithdrawalGetByIdParam) {
    return request.post<BaseResult>({
      url: '/buyer_withdrawal/handle',
      data: params
    })
  }

  // ============================财务管理============================

  // 财务管理查询
  static getAllFinance(params: FinanceParam) {
    return request.post<BaseResult<PageResult<FinanceCount>>>({
      url: '/finance/getAllFinance',
      data: params
    })
  }

  // 保证金管理查询
  static getAllBond(params: BondParam) {
    return request.post<BaseResult<BondCount>>({
      url: '/finance/getAllBond',
      data: params
    })
  }
}
